package com.yjhb.android.sbz.activity;

import androidx.viewpager.widget.ViewPager;

import com.google.android.material.tabs.TabLayout;
import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.fragment.FollowFragment;
import com.jojo.android.zxlib.adapter.FragmentAdapter;
import com.jojo.android.zxlib.base.BaseFragment;
import com.jojo.android.zxlib.base.mvp.BasePresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 创建者 zx
 * 创建时间 2021/1/11 10:08
 */
public class MyFollowActivity extends BaseActivity {
    private final String TAG = "MyFollowActivity";
    @BindView(R.id.tabLayout)
    TabLayout tabLayout;
    @BindView(R.id.viewpager)
    ViewPager viewpager;

    List<BaseFragment> fragments = new ArrayList<>();
    FollowFragment fragment1;
    FollowFragment fragment2;

    FragmentAdapter fragmentAdapter;

    @Override
    protected BasePresenter initPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_my_follow;
    }

    @Override
    protected void initUI() {
        fragments.clear();
        fragments.add(fragment1 = new FollowFragment());
        fragment1.setType(1);
        fragments.add(fragment2 = new FollowFragment());
        fragment2.setType(2);
        viewpager.setAdapter(fragmentAdapter = new FragmentAdapter(getSupportFragmentManager(), fragments));
        tabLayout.setupWithViewPager(viewpager);
        tabLayout.getTabAt(0).setText("关注");
        tabLayout.getTabAt(1).setText("粉丝");
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void regEvent() {

    }

    @OnClick(R.id.back)
    void back() {
        finish();
    }
}
